package com.qyhl.webtv.commonlib.item;

import android.view.View;
import android.widget.TextView;

import com.qyhl.webtv.commonlib.R;
import com.qyhl.webtv.commonlib.entity.news.GlobalNewsBean;
import com.zhy.adapter.recyclerview.base.ItemViewDelegate;
import com.zhy.adapter.recyclerview.base.ViewHolder;


/**
 * Created by qyhl on 2017/12/1.
 */

public class ItemUnionTag implements ItemViewDelegate<GlobalNewsBean> {
    @Override
    public int getItemViewLayoutId() {
        return R.layout.news_item_union_title;
    }

    @Override
    public boolean isForViewType(GlobalNewsBean item, int position) {
        if ("100".equals(item.getType())) {
            return true;
        } else {
            return false;
        }

    }

    @Override
    public void convert(ViewHolder holder, GlobalNewsBean bean, int position) {
        TextView title = holder.getView(R.id.title);
        title.setText(bean.getTitle());

        TextView numTag = holder.getView(R.id.numtag);

        if (bean.getScanNum() == 0 || bean.getNewsStyle() == 0) {
            numTag.setVisibility(View.GONE);
        } else {
            numTag.setVisibility(View.VISIBLE);
            numTag.setText(bean.getScanNum() + "/" + bean.getNewsStyle());
        }

    }
}
